<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/default.min.css">
  <style>
    body{
      background-color: #1661ab;
    }
    .code{
      margin:20px auto;
      font-size: 18px;
        text-space: 10px;
        line-height: 30px;
      width: 80%;
    }


    .python{
       background-color: #f6f8fa;
      border-radius: 10px;
      color: #f3260d;
      font-family: "Titan One", cursive;
    }
  </style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/highlight.min.js"></script>

<!-- and it's easy to individually load additional languages -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/languages/go.min.js"></script>

<script>hljs.highlightAll();</script>
</head>
<body>
<div class="code">
  <pre><code class="python">        print("跑步距离："+v*times)
# ###
# 编写 CollegeStudent 类继承 Student 类，具有以下属性和方法：
#
# 属性：姓名 name, 年龄 age, 学校 school, 学号 my_id 和 语言 language
# 方法：speak()，打印出当前 CollegeStudent 对象的所有属性信息
# 方法：coding()，使用10秒钟打印出 "I am coding .........."（十个点）
# ###
class CollegeStudent(student):
    def __init__(self, name, age, school, my_id,language):
        self.name = name
        self.age = age
        self.school = school
        self.my_id = my_id
        self.language=language

    def speak(self):
        print(f"我是{self.name}, 今年{self.age}岁了, 我来自{self.school}, 学号是{self.my_id,}，我会{self.language}。")

    def coding(self):
        print("I am coding", end=" ")
        for i in range(10):
            print(".", end="")
            sleep(1)
a = CollegeStudent('Jim', 18, 'Blueking', 200101, 'English')
a.speak()
a.coding()

  </code></pre>
</div>

</body>
</html>







from functools import wraps
from datetime import datetime

class AuthClass:
    def __init__(self, name, pwd):
        self.name = name
        self.pwd = pwd

    def auth(self):
        if self.name == "python" and self.pwd == "123":
            return True
        else:
            return False


user = AuthClass("python", "123")
def fun(f):
    @wraps(f)
    def inner(*args,**kwargs):
        if user.auth():
            print("succese!!!"+f.__name__)
            return f(*args,**kwargs)
        else:
            return False;
    return inner
@fun
def f(name):
    print(f"my name is {name}")
f("yuwei")

def log_it(logfile='out.log'):
    def logging_decorator(func):
        def wrapped_function(*args, **kwargs):
            log = f"[{datetime.now()}] {func.__name__} was called"
            # 打开logfile，并写入内容
            with open(logfile, 'a') as fd:
                # 现在将日志打到指定的logfile
                fd.write(log + '\n')
            return func(*args, **kwargs)
        return wrapped_function
    return logging_decorator
@log_it('log.txt')
def f(name):
    return f"my name is {name}"
print(f('yuwei'))
print(datetime.now())
log=datetime.now()